<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('考试统计')" />
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="notice-form">
					<div class="select-list">
						<ul>
							<li>
								考试名称：<input type="text" name="title" th:value="${model.title}" autocomplete="off"/>
								<input type="hidden" name="examId" th:value="${model.id}" autocomplete="off"/>
							</li>
							<li>
								用户姓名：<input type="text" name="userName" autocomplete="off"/>
							</li>
							<li>
								是否考试：
								<select name="examState" >
									<option value="">所有</option>
									<option value="1">已考</option>
									<option value="0">未考</option>
								</select>
							</li>
							<li>
								是否通过：
								<select name="passed" >
									<option value="">所有</option>
									<option value="true">通过</option>
									<option value="false">未过</option>
								</select>
							</li>								
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	         <div class="btn-group-sm" id="toolbar" role="group">
		        <a class="btn btn-warning" >
		            <i class="fa fa-plus"></i> 导出
		        </a>
	        </div> 
	        <div class="col-sm-12 select-table table-striped">
	            <table id="bootstrap-table"></table>
	        </div>
    	</div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "exam/userExam";
        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "考试统计",
                showSearch: false,
                showRefresh: false,
                showColumns: false,
                showToggle:  false,
                columns: [
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'title', 
					title : '考试名称',
				},
				{
					field : 'userName', 
					title : '用户名',
				},
				{
					field : 'tryCount', 
					title : '考试次数'
					
				},
				{
					field : 'maxScore', 
					title : '最高分'
					
				},
				{
					field : 'examState', 
					title : '是否考试',
					formatter: function(value, row, index) {
						if(value=='0'){
							return '<span class="badge badge-danger">未考</span>';
						}
						return '<span class="badge badge-primary">已考</span>';
					}
				},
				{
					field : 'passed', 
					title : '是否通过',
					formatter: function(value, row, index) {
						if(value){
							return '<span class="badge badge-primary">通过</span>';
						}
						return '<span class="badge badge-danger">未通过</span>';
					}
				}]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>